import 'package:flutter/material.dart';
import '../shared/styles.dart';
import '../shared/colors.dart';
import '../shared/buttons.dart';

import 'package:page_transition/page_transition.dart';
import './signup_page.dart';
import './signIn_page.dart';

class HomePage extends StatefulWidget {
  final String? pageTitle;

  HomePage({Key? key, this.pageTitle}) : super(key: key);

  @override
  _HomePageState createState() => _HomePageState();
}

class _HomePageState extends State<HomePage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Center(
          child: Column(
        mainAxisAlignment: MainAxisAlignment.center,
        crossAxisAlignment: CrossAxisAlignment.center,
        children: <Widget>[
          Image.asset('images/welcome.png', width: 190, height: 190),
          Container(
            margin: const EdgeInsets.only(bottom: 10, top: 0),
            child: const Text('XJn 1210204048', style: logoStyle),
          ),
          Container(
            width: 200,
            margin: const EdgeInsets.only(bottom: 0),
            child: froyoFlatBtn('已有账号, 前往登陆', () {
              Navigator.push(
                context,
                PageTransition(
                  type: PageTransitionType.rotate,
                  alignment: const Alignment(1, -1),
                  duration: const Duration(seconds: 1),
                  child: SignInPage(),
                ),
              );
            }),
          ),
          Container(
            width: 200,
            padding: const EdgeInsets.all(0),
            child: froyoOutlineBtn('注册', () {
              Navigator.push(
                  context,
                  PageTransition(
                      type: PageTransitionType.rotate,
                      alignment: const Alignment(1, -1),
                      duration: const Duration(seconds: 1),
                      child: SignUpPage()));
              // Navigator.of(context).pushReplacementNamed('/signup');
            }),
          ),
        ],
      )),
      backgroundColor: bgColor,
    );
  }
}
